package com.chezai.client.bean;

import com.chezai.client.dao.ClassRecordDao;
import com.chezai.client.dao.CoachLoginRecordDao;
import com.chezai.client.dao.DaoSession;
import com.chezai.client.dao.StudentStudyRecordDao;
import com.chezai.client.dao.UserInfoDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToOne;

/**
 * 学员登录记录表
 * Created by likunyang on 2017/9/22.
 */
@Entity
public class StudentStudyRecord {
    @Id(autoincrement = true)
    private Long _ID;
    //对应人员信息表中的_ID
    private Long studentId;
    //对应教练登录记录表_ID
    private Long coachLoginRecordId;
    //对应ClassRecord _ID
    private Long classRecordId;

    //登录日期 yyyy/MM/dd
    private String createDay;
    //登录登出时间  HH:mm
    private Long siginInTime;
    private Long siginOutTime;
    private Long updateTime;

    @ToOne(joinProperty = "studentId")
    private UserInfo stuInfo;//学员信息
    @ToOne(joinProperty = "classRecordId")
    private ClassRecord classRecord;
    @ToOne(joinProperty = "coachLoginRecordId")
    private CoachLoginRecord coachLoginRecord;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 1439189323)
    private transient StudentStudyRecordDao myDao;
    @Generated(hash = 2037008720)
    public StudentStudyRecord(Long _ID, Long studentId, Long coachLoginRecordId,
            Long classRecordId, String createDay, Long siginInTime, Long siginOutTime,
            Long updateTime) {
        this._ID = _ID;
        this.studentId = studentId;
        this.coachLoginRecordId = coachLoginRecordId;
        this.classRecordId = classRecordId;
        this.createDay = createDay;
        this.siginInTime = siginInTime;
        this.siginOutTime = siginOutTime;
        this.updateTime = updateTime;
    }
    @Generated(hash = 821090109)
    public StudentStudyRecord() {
    }
    public Long get_ID() {
        return this._ID;
    }
    public void set_ID(Long _ID) {
        this._ID = _ID;
    }
    public Long getStudentId() {
        return this.studentId;
    }
    public void setStudentId(Long studentId) {
        this.studentId = studentId;
    }
    public Long getCoachLoginRecordId() {
        return this.coachLoginRecordId;
    }
    public void setCoachLoginRecordId(Long coachLoginRecordId) {
        this.coachLoginRecordId = coachLoginRecordId;
    }
    public Long getClassRecordId() {
        return this.classRecordId;
    }
    public void setClassRecordId(Long classRecordId) {
        this.classRecordId = classRecordId;
    }
    public String getCreateDay() {
        return this.createDay;
    }
    public void setCreateDay(String createDay) {
        this.createDay = createDay;
    }
    public Long getSiginInTime() {
        return this.siginInTime;
    }
    public void setSiginInTime(Long siginInTime) {
        this.siginInTime = siginInTime;
    }
    public Long getSiginOutTime() {
        return this.siginOutTime;
    }
    public void setSiginOutTime(Long siginOutTime) {
        this.siginOutTime = siginOutTime;
    }
    @Generated(hash = 2008401255)
    private transient Long stuInfo__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 1741756434)
    public UserInfo getStuInfo() {
        Long __key = this.studentId;
        if (stuInfo__resolvedKey == null || !stuInfo__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            UserInfoDao targetDao = daoSession.getUserInfoDao();
            UserInfo stuInfoNew = targetDao.load(__key);
            synchronized (this) {
                stuInfo = stuInfoNew;
                stuInfo__resolvedKey = __key;
            }
        }
        return stuInfo;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 2044349248)
    public void setStuInfo(UserInfo stuInfo) {
        synchronized (this) {
            this.stuInfo = stuInfo;
            studentId = stuInfo == null ? null : stuInfo.get_ID();
            stuInfo__resolvedKey = studentId;
        }
    }
    @Generated(hash = 1994963714)
    private transient Long classRecord__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 860191290)
    public ClassRecord getClassRecord() {
        Long __key = this.classRecordId;
        if (classRecord__resolvedKey == null
                || !classRecord__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ClassRecordDao targetDao = daoSession.getClassRecordDao();
            ClassRecord classRecordNew = targetDao.load(__key);
            synchronized (this) {
                classRecord = classRecordNew;
                classRecord__resolvedKey = __key;
            }
        }
        return classRecord;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1170919615)
    public void setClassRecord(ClassRecord classRecord) {
        synchronized (this) {
            this.classRecord = classRecord;
            classRecordId = classRecord == null ? null : classRecord.get_ID();
            classRecord__resolvedKey = classRecordId;
        }
    }
    @Generated(hash = 1415276229)
    private transient Long coachLoginRecord__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 740908418)
    public CoachLoginRecord getCoachLoginRecord() {
        Long __key = this.coachLoginRecordId;
        if (coachLoginRecord__resolvedKey == null
                || !coachLoginRecord__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            CoachLoginRecordDao targetDao = daoSession.getCoachLoginRecordDao();
            CoachLoginRecord coachLoginRecordNew = targetDao.load(__key);
            synchronized (this) {
                coachLoginRecord = coachLoginRecordNew;
                coachLoginRecord__resolvedKey = __key;
            }
        }
        return coachLoginRecord;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 45561779)
    public void setCoachLoginRecord(CoachLoginRecord coachLoginRecord) {
        synchronized (this) {
            this.coachLoginRecord = coachLoginRecord;
            coachLoginRecordId = coachLoginRecord == null ? null
                    : coachLoginRecord.get_ID();
            coachLoginRecord__resolvedKey = coachLoginRecordId;
        }
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1127433296)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getStudentStudyRecordDao() : null;
    }
    public Long getUpdateTime() {
        return this.updateTime;
    }
    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

}
